//
//  HEFindTeamCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2021/1/20.
//  Copyright © 2021 honglutec. All rights reserved.
//

#import "HEFindTeamCell.h"

@interface HEFindTeamCell ()

@property (nonatomic, strong) UIImageView *goodsimgView;
@property (nonatomic, strong) UILabel *titleLb;
@property (nonatomic, strong) UILabel *deptLb;
@property (nonatomic, strong) UILabel *hospLb;
@property (nonatomic, strong) UILabel *descLb;

@end

@implementation HEFindTeamCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.qmui_borderPosition = QMUIViewBorderPositionTop;
        self.qmui_borderWidth = 0.5;
        self.qmui_borderColor = CSplitLineColor;
     
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    UIView *warp = [UIView new];
    warp.backgroundColor = KWhiteColor;
    [self.contentView addSubview:warp];
    
    warp.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
    warp.layer.shadowColor = [UIColor colorWithRed:13/255.0 green:98/255.0 blue:218/255.0 alpha:0.08].CGColor;
    warp.layer.shadowOffset = CGSizeMake(0,5);
    warp.layer.shadowOpacity = 1;
    warp.layer.shadowRadius = 6;
    
    [warp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(10);
        make.left.equalTo(self.contentView).mas_offset(10);
        make.right.equalTo(self.contentView).mas_offset(-10);
        make.height.mas_greaterThanOrEqualTo(110);
        make.bottom.equalTo(self.contentView).mas_offset(-0);
    }];
    
    // 商品图片
    _goodsimgView = [UIImageView new];
    _goodsimgView.image = IMAGE_NAMED(@"noImage");
    _goodsimgView.contentMode = UIViewContentModeScaleAspectFill;
    [warp addSubview:_goodsimgView];

    // 姓名
    _titleLb = [UILabel new];
    _titleLb.text = @"-";
    _titleLb.font = DYBlodFont(18);
    _titleLb.textColor = CNavLightBlackColor;
    [warp addSubview:_titleLb];

    // 科室
    _deptLb = [UILabel new];
    _deptLb.text = @"-";
    _deptLb.font = DYFont(15);
    _deptLb.textColor = CNavDargGrayColor;
    _deptLb.numberOfLines = 0;
    [warp addSubview:_deptLb];

    // 所属医院
    _hospLb = [UILabel new];
    _hospLb.text = @"-";
    _hospLb.font = DYFont(15);
    _hospLb.textColor = CNavDargGrayColor;
    _hospLb.numberOfLines = 0;
    [warp addSubview:_hospLb];


    // 描述
    _descLb = [UILabel new];
    _descLb.text = @"-";
    _descLb.font = DYFont(15);
    _descLb.textColor = CNavLightBlackColor;
    _descLb.numberOfLines = 2;
    [warp addSubview:_descLb];
    

    [_goodsimgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(warp);
        make.left.equalTo(warp).mas_offset(15);
        make.width.height.mas_offset(80);
    }];
    _goodsimgView.layer.masksToBounds = YES;
    _goodsimgView.layer.cornerRadius = 8;

    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).offset(15);
        make.left.equalTo(_goodsimgView.mas_right).mas_offset(10);
        make.right.equalTo(warp).mas_offset(-10);
    }];

    [_deptLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(10);
        make.left.equalTo(_titleLb.mas_left);
        make.right.equalTo(warp).mas_offset(-10);
    }];
  
    [_hospLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_deptLb.mas_bottom).mas_offset(5);
        make.left.equalTo(_titleLb.mas_left);
        make.right.equalTo(warp).mas_offset(-10);
    }];
 
    [_descLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_hospLb.mas_bottom).mas_offset(10);
        make.left.equalTo(_titleLb.mas_left);
        make.right.equalTo(warp).mas_offset(-10);
        make.bottom.equalTo(warp.mas_bottom).mas_offset(-15);
    }];
}

- (void)setModel:(HETeamModel *)model {
    _model = model;
    
    [_goodsimgView sd_setImageWithURL:[NSURL URLWithString:model.teamIcon] placeholderImage: IMAGE_NAMED(@"noImage")];
    _titleLb.text = model.teamName;
    _deptLb.text = model.KteamDeptName;
    _hospLb.text = model.teamHospitalName;
    _descLb.text = model.KteamDesc;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
